Skip to content

Switch POCL backend to CompilerCaching.jl#728

Merged
vchuravy merged 4 commits into
mainfrom
vc/compilercaching
Jul 17, 2026
Merged

Switch POCL backend to CompilerCaching.jl#728
vchuravy merged 4 commits into
mainfrom
vc/compilercaching

Conversation

@vchuravy

@vchuravy vchuravy commented Jul 10, 2026

Copy link
Copy Markdown
Member

Adopts the new GPUCompiler 2.0 caching API for the POCL backend, x-ref JuliaGPU/GPUCompiler.jl#794, following the same approach as JuliaGPU/OpenCL.jl#431:

  • Compilation artifacts (SPIR-V bytes, entry name, device_rng flag) now live in an OpenCLResults struct managed by GPUCompiler.cached_results, i.e. attached to the CodeInstance in Julia's integrated code cache on 1.11+ (persisting through precompilation) instead of the legacy per-context cached_compilation dictionaries.
  • Linked cl.Kernel handles are session-local and kept in a small per-context linear cache on the results struct; they are not populated while precompiling, so no dangling handles end up in package images.
  • GPUCompiler.reset_runtime() is gone (the runtime library is cached through the same mechanism now).
  • Adds a compilation-cache regression test mirroring the one from the OpenCL.jl PR.

GPUCompiler 2.0 is now registered, so the [sources] branch pin is dropped and the compat bound is "2". compile_or_lookup is adapted to the released cached_results API, which returns nothing until code exists for the job and is re-fetched after compiling — matching the final form merged in JuliaGPU/OpenCL.jl#431.

🤖 Generated with Claude Code

Closes #729

@vchuravy
vchuravy marked this pull request as ready for review July 14, 2026 09:05
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Benchmark Results

Show table
main 02a87d3... main / 02a87d3...
saxpy/default/Float32/1024 0.063 ± 0.032 ms 0.0619 ± 0.034 ms 1.02 ± 0.76
saxpy/default/Float32/1048576 0.512 ± 0.018 ms 0.513 ± 0.02 ms 0.998 ± 0.054
saxpy/default/Float32/16384 0.0528 ± 0.03 ms 0.0517 ± 0.03 ms 1.02 ± 0.82
saxpy/default/Float32/2048 0.0646 ± 0.026 ms 0.0641 ± 0.029 ms 1.01 ± 0.62
saxpy/default/Float32/256 0.045 ± 0.035 ms 0.062 ± 0.034 ms 0.726 ± 0.69
saxpy/default/Float32/262144 0.18 ± 0.025 ms 0.18 ± 0.026 ms 0.998 ± 0.2
saxpy/default/Float32/32768 0.0683 ± 0.031 ms 0.06 ± 0.031 ms 1.14 ± 0.79
saxpy/default/Float32/4096 0.0679 ± 0.028 ms 0.0678 ± 0.026 ms 1 ± 0.56
saxpy/default/Float32/512 0.0487 ± 0.035 ms 0.047 ± 0.035 ms 1.04 ± 1.1
saxpy/default/Float32/64 0.0516 ± 0.036 ms 0.0582 ± 0.035 ms 0.886 ± 0.81
saxpy/default/Float32/65536 0.0935 ± 0.03 ms 0.0902 ± 0.03 ms 1.04 ± 0.49
saxpy/default/Float64/1024 0.0648 ± 0.029 ms 0.0639 ± 0.032 ms 1.01 ± 0.67
saxpy/default/Float64/1048576 0.542 ± 0.11 ms 0.544 ± 0.18 ms 0.997 ± 0.39
saxpy/default/Float64/16384 0.0628 ± 0.031 ms 0.0747 ± 0.03 ms 0.84 ± 0.54
saxpy/default/Float64/2048 0.0645 ± 0.028 ms 0.0654 ± 0.029 ms 0.985 ± 0.61
saxpy/default/Float64/256 0.0615 ± 0.035 ms 0.0599 ± 0.035 ms 1.03 ± 0.84
saxpy/default/Float64/262144 0.183 ± 0.018 ms 0.183 ± 0.017 ms 1 ± 0.13
saxpy/default/Float64/32768 0.0789 ± 0.031 ms 0.0825 ± 0.031 ms 0.956 ± 0.51
saxpy/default/Float64/4096 0.0691 ± 0.023 ms 0.0678 ± 0.025 ms 1.02 ± 0.5
saxpy/default/Float64/512 0.0551 ± 0.035 ms 0.0587 ± 0.035 ms 0.938 ± 0.82
saxpy/default/Float64/64 0.0632 ± 0.035 ms 0.0592 ± 0.035 ms 1.07 ± 0.86
saxpy/default/Float64/65536 0.0982 ± 0.027 ms 0.0982 ± 0.027 ms 0.999 ± 0.39
saxpy/static workgroup=(1024,)/Float32/1024 0.0641 ± 0.032 ms 0.0663 ± 0.031 ms 0.968 ± 0.66
saxpy/static workgroup=(1024,)/Float32/1048576 0.465 ± 0.022 ms 0.459 ± 0.024 ms 1.01 ± 0.073
saxpy/static workgroup=(1024,)/Float32/16384 0.051 ± 0.028 ms 0.0587 ± 0.029 ms 0.869 ± 0.65
saxpy/static workgroup=(1024,)/Float32/2048 0.0626 ± 0.027 ms 0.0627 ± 0.028 ms 0.999 ± 0.61
saxpy/static workgroup=(1024,)/Float32/256 0.0567 ± 0.036 ms 0.0627 ± 0.035 ms 0.904 ± 0.76
saxpy/static workgroup=(1024,)/Float32/262144 0.169 ± 0.032 ms 0.167 ± 0.031 ms 1.01 ± 0.26
saxpy/static workgroup=(1024,)/Float32/32768 0.0671 ± 0.03 ms 0.0686 ± 0.031 ms 0.977 ± 0.62
saxpy/static workgroup=(1024,)/Float32/4096 0.066 ± 0.024 ms 0.0665 ± 0.024 ms 0.993 ± 0.51
saxpy/static workgroup=(1024,)/Float32/512 0.0593 ± 0.035 ms 0.0599 ± 0.036 ms 0.99 ± 0.83
saxpy/static workgroup=(1024,)/Float32/64 0.0635 ± 0.033 ms 0.0634 ± 0.035 ms 1 ± 0.75
saxpy/static workgroup=(1024,)/Float32/65536 0.0876 ± 0.03 ms 0.0896 ± 0.031 ms 0.978 ± 0.48
saxpy/static workgroup=(1024,)/Float64/1024 0.0634 ± 0.027 ms 0.0641 ± 0.03 ms 0.988 ± 0.62
saxpy/static workgroup=(1024,)/Float64/1048576 0.48 ± 0.019 ms 0.482 ± 0.022 ms 0.997 ± 0.06
saxpy/static workgroup=(1024,)/Float64/16384 0.0661 ± 0.029 ms 0.069 ± 0.029 ms 0.959 ± 0.59
saxpy/static workgroup=(1024,)/Float64/2048 0.0629 ± 0.028 ms 0.0633 ± 0.029 ms 0.995 ± 0.63
saxpy/static workgroup=(1024,)/Float64/256 0.0599 ± 0.036 ms 0.0646 ± 0.033 ms 0.927 ± 0.73
saxpy/static workgroup=(1024,)/Float64/262144 0.173 ± 0.028 ms 0.173 ± 0.029 ms 1 ± 0.23
saxpy/static workgroup=(1024,)/Float64/32768 0.0761 ± 0.031 ms 0.0759 ± 0.03 ms 1 ± 0.56
saxpy/static workgroup=(1024,)/Float64/4096 0.0674 ± 0.023 ms 0.0665 ± 0.024 ms 1.01 ± 0.5
saxpy/static workgroup=(1024,)/Float64/512 0.0583 ± 0.035 ms 0.0575 ± 0.036 ms 1.01 ± 0.88
saxpy/static workgroup=(1024,)/Float64/64 0.0572 ± 0.036 ms 0.0593 ± 0.035 ms 0.965 ± 0.83
saxpy/static workgroup=(1024,)/Float64/65536 0.0942 ± 0.03 ms 0.094 ± 0.03 ms 1 ± 0.45
time_to_load 1.09 ± 0.0072 s 1.18 ± 0.013 s 0.927 ± 0.012

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@christiangnrd

Copy link
Copy Markdown
Member

Rebasing to pick up #731 should fix the buildkite failures

vchuravy and others added 3 commits July 17, 2026 17:06
Adopts the GPUCompiler 2.0 caching API (JuliaGPU/GPUCompiler.jl#794):
compilation results are stored via `GPUCompiler.cached_results` on the
CodeInstance (Julia's integrated code cache on 1.11+, persisting through
precompilation) instead of the legacy per-context `cached_compilation`
dictionaries. Follows the same approach as JuliaGPU/OpenCL.jl#431.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Remove the `[sources]` pin to the `tb/compilercaching` branch; the caching
API it relied on shipped in the registered GPUCompiler 2.0 (compat is
already `"2"`).

Adapt `compile_or_lookup` to the released `cached_results` API: it now
returns `nothing` until code exists for the job (rather than always
materializing an empty results struct), so re-fetch after compiling —
which populates Julia's code cache — via `@something`. Matches the final
form merged in JuliaGPU/OpenCL.jl#431.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop EnzymeCore from weakdeps/extensions so EnzymeExt is not loaded.
The Enzyme testset was already commented out and Aqua already
ignores Enzyme/EnzymeCore for stale deps/compat checks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vchuravy
vchuravy force-pushed the vc/compilercaching branch from 7d63e97 to bff8c5c Compare July 17, 2026 15:06
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 64.76%. Comparing base (0534c73) to head (02a87d3).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/pocl/compiler/execution.jl 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #728      +/-   ##
==========================================
+ Coverage   64.57%   64.76%   +0.19%     
==========================================
  Files          23       23              
  Lines        2010     2021      +11     
==========================================
+ Hits         1298     1309      +11     
  Misses        712      712              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vchuravy
vchuravy merged commit e0e969a into main Jul 17, 2026
57 of 61 checks passed
@vchuravy
vchuravy deleted the vc/compilercaching branch July 17, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants